/* eslint-disable no-dupe-else-if */
import { defineDirective } from "@/shared/define.js";

export const AppDirective = defineDirective(() => ({
  restrict: "A",
  link(scope, element, attrs, controller, transclude) {
    transclude?.(
      scope,
      /**
       * @param {JQuery<HTMLElement>=} clonedElement
       * @param {ng.IScope=} scope
       * @returns {void}
       */
      (clonedElement, scope) => {
        clonedElement?.appendTo(element);
      },
    );
  },
}));

if (__App__) {
  if (__App__.info({ name: "1" }) && __App__.info({ name: 1 })) {
    __App__.info().name;
  } else if (__App__.info({ name: 1 }) && __App__.info({ name: "1" })) {
    __App__.info().name;
  }
}
